<template>
  <view class="proto-list-wrapper">
    <view class="list_1 flex-col" v-if="workarr?.length">
      <view class="box_4 flex-col" @click="godetail(item.position_id)" v-for="(item, index) in workarr" :key="index">
        <view class="box_8 align-center justify-between">
          <view class="box_busimg align-center">
            <image class="thumbnail_8" referrerpolicy="no-referrer" :src="busimg" />
            <text class="text_12" v-text="item?.name"></text>
          </view>
          <text class="text_33" v-text="item?.salary_down + '-' + item?.salary_up"></text>
        </view>
        <view class="box_9 flex-row">
          <text class="text_14" v-text="item?.position_city"></text>
          <text class="text_13" v-text="item?.title"></text>
          <view class="text-wrapper_1 flex-col">
            <text class="text_34">已投递</text>
          </view>
        </view>
        <text class="text_16" v-text="'练习电话：' + item.tel"></text>
      </view>
    </view>
    <emptyimg v-if="!workarr?.length"></emptyimg>

  </view>
</template>

<script setup lang="ts">
import '@/static/common.less';
import './index.less';
import { getCurrentInstance, ref, toRaw } from 'vue';
import Taro, {
  useLoad,
  usePullDownRefresh,
  useReachBottom,
  useShareAppMessage,
  useShareTimeline,
  useTitleClick,
} from '@tarojs/taro';
import { CategoryType, getCategoriesApi } from '@/api/categories';
import { loginapi } from '@/api/platform';
import { recruitfavor, applylist } from '@/api/moredetail';
import Emptyimg from "@/components/empty-img/index.vue"
import busimg from "@/assets/lanhu_59wode/business.png"

import ProtoList from '@/components/proto-list/index.vue';
// import LoadMoreBottom from '@/components/load-more-bottom/index.vue';
import { getProtoListApi, ProtoType } from '@/api/proto';
import SimpleTabs from '@/components/simple-tabs/index.vue';
const container2 = ref(null);
let savesearch = '';
let totalcount = 0;
// const windowInfo = Taro.getWindowInfo();
// const { proxy } = getCurrentInstance();
const useInfo = Taro.getStorageSync('useInfo');

const query = ref({
  page: 1,
  limit: 6,
  category_id: '',
  sort_by: '',
  keywords: '',
});
const searchabout = ref({
  page: 0,
  count: 10,
});
const workarr = ref([]);

// const protoListLoading = ref(false);
// const noMore = ref(true);
// category_id: null
// city: "南京市"
// company_id: null
// hits: null
// hr_id: null
// id: 5
// quantity: 30
// release_date: null
// requirement: null
// salary_down: 5000
// salary_up: 8000
// state: null
// title: "C++工程师"
const categories = ref<CategoryType[]>([]);
const protoItems = ref<ProtoType[]>([]);
const tab1value = ref('0');
// const protoTotal = ref<number>(0);
const favtorgroup = ref([]);
const handleProtoClick = (proto: ProtoType) => {
  console.log(handleProtoClick);
};


const getlist = () => {
  if (useInfo) {
    let id = JSON.parse(useInfo)?.id;
    applylist({ id: id || 4, userId: id || 4, ...searchabout.value}).then((res: any) => {
      let arr = toRaw(workarr)
      console.log(arr)
      workarr.value = arr.value.concat(res.items);
    });
  }
};
getlist()

useReachBottom(() => {
  searchabout.value.page++
  getlist()
});
const godetail = (id) => {
  Taro.navigateTo({ url: `/pages/workdetail/index?id=${id}` });
};
</script>
